<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>localStorage</title>
	</head>
	<body>
        <p>到 开发者工具>本地存储 查看</p>
		<script>
			var data = {    // JSON数据
				name: "man",
				apple: "3"
			}
			
			var d = JSON.stringify(data);   // 转成字符串
			window.localStorage.setItem("data", d); // 存储到浏览器
			
			var json = localStorage.getItem("data"); // 从浏览器get
			var jsonObj = JSON.parse(json);
			console.log(typeof jsonObj);
		</script>
	</body>
</html>
